import 'package:beautiful_demo/common/manager/user.dart';
import 'package:beautiful_demo/common/res.dart';
import 'package:beautiful_demo/common/widget/widget.dart';
import 'package:drive/drive.dart';
import 'package:flutter/material.dart';

import 'controller.dart';

///description:我的


class InfoWidget extends StatelessWidget {
  const InfoWidget({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return  Container(  padding: EdgeInsets.only(
        left: 25.dp,
        right: 12.dp),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          CachedImageShadow(
            url: UserManager.instance.data?.logo??"",
            width: 80.dp,
            border: Border.all(color: Colors.white,width: 2.dp),
            height: 80.dp,
            boxShadow: const [
              BoxShadow(
                  color: Color(0x22333333),
                  offset: Offset(0, 3),
                  blurRadius: 5)
            ],
          ),
          SizedBox(
            width: 15.dp,
          ),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                SizedBox(
                  height: 13.dp,
                ),
                Text(
                  UserManager.instance.data?.nick??"",
                  style: resTextStyle.copyWith(
                      fontSize: 18.sp,
                      color: Colors.white,
                      shadows: const [
                        BoxShadow(
                            color: Color(0x22333333),
                            offset: Offset(0, 3),
                            blurRadius: 5)
                      ]),
                ),
                SizedBox(height: 16.dp),
                Text(
                  UserManager.instance.data?.phone?.toString()??"",
                  style: resTextStyle.copyWith(
                      fontSize: 14.sp,
                      shadows: const [
                        BoxShadow(
                            color: Color(0x22333333),
                            offset: Offset(0, 1),
                            blurRadius: 3)
                      ],
                      color: const Color(0xff333333)),
                )
              ],
            ),
          ),
          Container(
            width: 60.dp,height: 60.dp,
            decoration: BoxDecoration(
                color: Colors.white,
                boxShadow: const [
                  BoxShadow(
                      color: Color(0x22333333),
                      offset: Offset(0, 1),
                      blurRadius: 3)
                ],
                borderRadius: BorderRadius.circular(60.dp)),
            margin: EdgeInsets.only(top: 10.dp),
            child: Image.asset( "images/Icons8logo.png"),
          )
        ],
      ),
    );
  }
}


class Item1 extends StatelessWidget {
  const Item1({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 90.dp,
      padding: EdgeInsets.symmetric(horizontal: 10.dp),
      decoration: BoxDecoration(
          color: Colors.white,
          boxShadow: const [
            BoxShadow(
                color: Color(0x28333333), offset: Offset(1, 1), blurRadius: 5)
          ],
          borderRadius: BorderRadius.circular(15.dp)),
      margin: EdgeInsets.only(left: 15.dp, right: 15.dp, top: 30.dp),
      child: Row(
        children: [
          _buildItem("1,999", "Order"),
          _buildItem("3,222", "Send"),
          _buildItem("3,543", "Friend"),
          _buildItem("1,242", "Collect"),
        ],
      ),
    );
  }

  Widget _buildItem(String top, String bottom) {
    return Expanded(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          SizedBox(
            height: 8.dp,
          ),
          Text(
            top,
            style: resTextStyle30.copyWith(fontSize: 16.sp),
          ),
          SizedBox(
            height: 14.dp,
          ),
          Text(
            bottom,
            style: resTextStyle30.copyWith(fontSize: 14.sp),
          ),
        ],
      ),
    );
  }
}

class ImageWidget extends StatelessWidget {
  final String image;
  const ImageWidget(this.image,{Key key}) : super(key: key);
  // https://img-qn-1.51miz.com/Element/00/81/19/43/63187c84_E811943_c41a1154.jpg!/quality/90/unsharp/true/compress/true/format/jpg/fh/320
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 150.dp,
      decoration: BoxDecoration(
          color: Colors.white,
          image: DecorationImage(image: CachedNetworkImage(image, scale: 1,),fit: BoxFit.cover),
          boxShadow: const [
            BoxShadow(
                color: Color(0x20333333), offset: Offset(1, 0), blurRadius: 2)
          ],
          borderRadius: BorderRadius.circular(15.dp)),
      margin: EdgeInsets.only(left: 15.dp, right: 15.dp, top: 20.dp),
    );
  }
}

